<?php

use yii\helpers\Html;
use yii\widgets\DetailView;

$this->title = '卡名：' . $model->title;
$this->params['breadcrumbs'][] = ['label' => '微信会员卡', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="member-card-view">

    <h1><?= Html::encode($this->title) ?></h1>

    <p>
        <!-- <?= Html::a('更新', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?> -->
        <!-- <?= Html::a('删除', ['delete', 'id' => $model->id], [
            'class' => 'btn btn-danger',
            'data' => [
                'confirm' => 'Are you sure you want to delete this item?',
                'method' => 'post',
            ],
        ]) ?> -->
    </p>

    <?= DetailView::widget([
        'model' => $model,
        'attributes' => [
            'id',
            'identifier',
            'logo_url:url',
            [
                'attribute' => 'code_type',
                'value' => function($data){
                    $codeTypes = [
                        'CODE_TYPE_TEXT' => '文本',
                        'CODE_TYPE_BARCODE' => '一维码',
                        'CODE_TYPE_QRCODE' => '二维码',
                        'CODE_TYPE_ONLY_QRCODE' => '仅显示二维码',
                        'CODE_TYPE_ONLY_BARCODE' => '仅显示一维码',
                        'CODE_TYPE_NONE' => '不显示任何码型',
                    ];
                    return $codeTypes[$data->code_type];
                },
            ],
            'title',
            'card_id',
            'brand_name',
            [
                'attribute' => 'color',
                'format' => 'raw',
                'value' => function($data){
                    return '<span class="label label-default" style="background-color:' . $data->color . ';">' . $data->color . '</span>';
                },
            ],
            'notice',
            'description',
            'prerogative',
            'wx_activate_after_submit_url:url',
            'quantity',
            'total_quantity',
            'cost_money_unit',
            'increase_bonus',
            'max_increase_bonus',
            'init_increase_bonus',
            'cost_bonus_unit',
            'reduce_money',
            'least_money_to_use_bonus',
            'max_reduce_bonus',
            'created_at:datetime',
            'updated_at:datetime',
        ],
    ]) ?>

</div>
